<template>
  <svg class="svg-icon" :style="styles" aria-hidden="true">
    <use :xlink:href="iconName" />
  </svg>
</template>

<script>
export default {
  name: "SvgIcon",
  props: {
    type: {
      type: String,
      required: true
    },
    size: [String, Number]
  },
  computed: {
    iconName() {
      return `#icon-${this.type}`;
    },
    styles() {
      return {
        fontSize: this.size + "px"
      };
    }
  }
};
</script>

<style scoped>
.svg-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>
